package c18类加载和反射;

public class s11ClassLoaderTest {
	public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
		s10自定义ClassLoader m = new s10自定义ClassLoader(
				"/Users/yuanwl/Desktop",
				"myClassLoader"
		);

		Class c = m.loadClass("Wali"); //这个 class 文件要放在项目外
		System.out.println(c.getClassLoader()); //s10自定义ClassLoader
		System.out.println(c.getClassLoader().getParent()); //AppClassLoader
		System.out.println(c.getClassLoader().getParent().getParent()); //ExtClassLoader
		System.out.println(
				c.getClassLoader().getParent().getParent().getParent() //null, 因为 BootstrapClassLoader 是 c++写的
		);

		c.newInstance(); //触发静态代码块执行
	}
}
